package com.lzw.service.impl.dormitoryAdmin;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.lzw.mapper.dormitoryAdmin.AbsenceRecordMapper;
import com.lzw.pojo.AbsenceRecord;
import com.lzw.service.dormitoryAdmin.AbsenceRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Service
public class AbsenceRecordServiceImpl implements AbsenceRecordService {

    @Autowired
    private AbsenceRecordMapper absenceRecordMapper;

    @Override
    public List<AbsenceRecord> list(Integer pageNum, Integer pageSize, LocalDate absenceDate, String student) {
        PageHelper.startPage(pageNum,pageSize);
        List<AbsenceRecord> list = absenceRecordMapper.list(absenceDate,student);
        Page<AbsenceRecord> absenceRecords = (Page<AbsenceRecord>) list;
        return absenceRecords;
    }

    @Override
    public void delete(List<Integer> ids) {
        absenceRecordMapper.delete(ids);
    }

    @Override
    public void add(AbsenceRecord absenceRecord) {
        absenceRecordMapper.add(absenceRecord);
    }
}
